from php4dvd.pages.page import Page
from selenium.webdriver.common.by import By
from selenium.webdriver.remote import switch_to


class MoviePage(Page):
    @property
    def remove_movie_button(self):
        return self.driver.find_element_by_css_selector("img[alt=\"Remove\"]")

    @property
    def is_this_page(self):
        return self.is_element_visible((By.CSS_SELECTOR, "img[alt=\"Remove\"]"))

    def remove_this(self):
        self.remove_movie_button.click()
        #self.assertRegexpMatches(self.close_alert_and_get_its_text(), r"^Are you sure you want to remove this[\s\S]$")
        self.driver.switch_to.alert.accept()
        self.driver.set_page_load_timeout(20)

